<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>易抽奖-新建成功</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="index.css" type="text/css">
    <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
    <script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body>
<div class="container">
    <div class="row">
        <div class="col-lg-3 visible-xs-*"></div>
        <div class="col-lg-6" style="background-color:#DCDCDC"><br>
            <div align="center">
                <p class="font">已生成抽奖，您的活动邀请码为：</p>
                <p class="font3" id="passcode"></p>
                <p class="font">可通过邀请码搜索到该抽奖</p>

                <img src="./images/timg.png" width="200px" height="200px" style="position:center;">
                <br><br>
                <!--<button class="button2" id="share">分享给小伙伴</button>-->
                <br><br><br><br>
            </div>
            <!--<div class="theme-popover-mask">-->
                <!--<div class="theme-qrcode">-->
                    <!--<img src="./images/取消.svg" width="25px" height="25px"  id="close">-->
                    <!--<div align="center">-->
                        <!--<img id="pic" src="./images/礼物.svg" height="200px" width="200px" >-->
                    <!--</div>-->
                <!--</div>-->
            <!--</div>-->
        </div>
        <div class="col-lg-3 visible-xs-*"></div>
    </div>
</div>
</body>
<script>
    var passcode=0;
    var lotteryId=0;
    jQuery(document).ready(function () {
        function getUrlVal(para) {
            var search = location.search; //页面URL的查询部分字符串
            var arrPara = new Array(); //参数数组。数组单项为包含参数名和参数值的字符串，如“para=value”
            var arrVal = new Array(); //参数值数组。用于存储查找到的参数值

            if (search != "") {
                var index = 0;
                search = search.substr(1); //去除开头的“?”
                arrPara = search.split("&");

                for (i in arrPara) {
                    var paraPre = para + "="; //参数前缀。即参数名+“=”，如“para=”
                    if (arrPara[i].indexOf(paraPre) == 0 && paraPre.length < arrPara[i].length) {
                        arrVal[index] = decodeURI(arrPara[i].substr(paraPre.length)); //顺带URI解码避免出现乱码
                        index++;
                    }
                }
            }

            if (arrVal.length == 1) {
                return arrVal[0];
            } else if (arrVal.length == 0) {
                return null;
            } else {
                return arrVal;
            }
        }
        var url = window.location.search;
         passcode = getUrlVal("code");
        document.getElementById('passcode').innerHTML = passcode;
        lotteryId = getUrlVal("lotteryId");

    })

        $("button").click(function () {
            $('.theme-popover-mask').fadeIn(100);
            $('.theme-qrcode').slideDown(200);
            $("img#close").click(function () {
                $(".theme-qrcode").fadeOut(200)
                $(".theme-popover-mask").fadeOut(200)
            })
            $.get("http://yb.upc.edu.cn:8084/lottery/share",
                {
                    Authorization: localStorage.getItem("testtoken"),
                    lotteryId: lotteryId,
                },
                function (data) {

                    document.getElementById("pic").src = data.object;
                }
            )
        })
</script>
</html>